//
//  CommuntityCollectionViewCell.m
//  WhereToTravel
//
//  Created by dlios on 15/10/12.
//  Copyright © 2015年 zhoushengmin. All rights reserved.
//

#import "CommuntityCollectionViewCell.h"
#define W self.contentView.frame.size.width
#define H self.contentView.frame.size.height
@implementation CommuntityCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"night" object:nil];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(night) name:@"night" object:nil];

        self.labelName = [[UILabel alloc]init];
        self.labelName.frame = CGRectMake(W * 0.32, H * 0.05, W * 0.7, H * 0.4);
        self.labelName.font = [UIFont systemFontOfSize:11];
        self.labelName.numberOfLines = 0;
        [self.contentView addSubview:self.labelName];
        self.labelName.font = [UIFont fontWithName:@"Helvetica-Bold" size:14];
        
        
        self.image = [[UIImageView alloc]init];
        self.image.frame = CGRectMake(W * 0.01, H * 0.05, W * 0.3, H * 0.9);
        [self.contentView addSubview:self.image];
        
        
        self.labelNumber = [[UILabel alloc]init];
        self.labelNumber.frame = CGRectMake(W * 0.32, H * 0.5, W * 0.7, H * 0.4);
        self.labelNumber.font = [UIFont systemFontOfSize:9];
        [self.contentView addSubview:self.labelNumber];
        
    }
    return self;
}


- (void)night {
    if ([SingletonNight shareSingletonNight].isSelete == YES) {
        self.labelName.textColor = [UIColor whiteColor];
        self.labelNumber.textColor = [UIColor whiteColor];
    }
    else {
        self.labelName.textColor = [UIColor blackColor];
        self.labelNumber.textColor = [UIColor blackColor];
    }
}

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"night" object:nil];
}



@end
